import si from "@/assets/images/productImages/si.webp";
import chal from "@/assets/images/productImages/chal.webp";
import clsi from "@/assets/images/productImages/clsi.webp";
import chsi from "@/assets/images/productImages/chsi.webp";
import siclh from "@/assets/images/productImages/siclh.webp";
import sihcl3 from "@/assets/images/productImages/sihcl3.webp";
import xe from "@/assets/images/productImages/xe.webp";
import ne from "@/assets/images/productImages/ne.webp";
import kr from "@/assets/images/productImages/kr.webp";
import he from "@/assets/images/productImages/he.webp";
import ticl4 from "@/assets/images/productImages/TiCl4.webp";
import c3h8 from "@/assets/images/productImages/C3H8-fenzishi.webp";
import ch4 from "@/assets/images/productImages/ch4.webp";
import chf3 from "@/assets/images/productImages/chf3.webp";
import co from "@/assets/images/productImages/co.webp";
import hcl from "@/assets/images/productImages/hcl.webp";
export const productCategories = [
  { value: "all", icon: "mdi-view-grid" },
  { value: 1, icon: "mdi-flask" },
  { value: 2, icon: "mdi-gas-cylinder" },
  { value: 3, icon: "mdi-chip" },
];

// Precursors 类别产品数据 (categoryValue: 1)
export const precursorsData = [
  {
    id: 1,
    categoryValue: 1,
    name: "Si(CO2H5)4 (TEOS)",
    description:
      "Colorless liquid. Flammable. Slightly soluble in water, hydrolysis is slow in pure water, and can accelerate hydrolysis in the presence of acid or base; The reaction with boiling water gives silica sol without electrolyte. Ethyl orthosilicate reacts with higher alcohols or their esters in the presence of a catalyst. ",
    image: si,
    featured: true,
  },
  {
    id: 2,
    categoryValue: 1,
    name: "C₃H₉Al (TMA)",
    description:
      "Trimethylaluminum is a kind of organic compound, chemical formula C₃H₉Al, colorless transsparent liquid, mainly used as olefin polymerization catalyst, ignition fuel, also used in the production of straignt chain primary alcohol and olefin, but also can be used for metal organic compounds vapor deposition.",
    image: chal,
    featured: false,
  },
  {
    id: 3,
    categoryValue: 1,
    name: "Cl₆Si₂ (HCDS)",
    image: clsi,
    description:
      "Hexachlorodisilane is the inorganic compound with the chemical formula Si₂Cl₆, It is a colorless liquid that fumes in most air. It has specialty applications in as a reagent and as a volatile precursor to silicon metal.",
    featured: false,
  },
  {
    id: 4,
    categoryValue: 1,
    name: "C₄H₁₂Si (4MS)",
    image: chsi,
    description:
      "As an internal standard, it is often used in nnuclear magnetic resonance (NMR) test insoluble in water and cold concentrated sulfuric acid, soluble in ether an other organic solvents.",
    featured: false,
  },
  {
    id: 5,
    categoryValue: 1,
    name: "SIH₂CL₂ (DCS)",
    image: siclh,
    description:
      "It's an organic chemical, colorless, highly toxic, caustic, flammable liquefied gas, suffocating with a pungent smell of hydrochloric acid.",
    featured: false,
  },
  {
    id: 6,
    categoryValue: 1,
    name: "SIHCL₃ (TCS)",
    image: sihcl3,
    description:
      "It is a colorless transparent liquid with the molecular formula CIBHSi and molecular weight 135.45. It is used as raw material of high polymer organosilicon compound and also used in instrument industry.",
    featured: false,
  },
];

// Speciality Gases 类别产品数据 (categoryValue: 2)
export const specialityGasesData = [
  {
    id: 7,
    categoryValue: 2,
    name: "Xe",
    image: xe,
    description:
      "Is a chemical element, its chemical symbol is Xe, its atomic number is 54, is a colorless noble gas, it is bright white when discharged.",
    featured: true,
  },
  {
    id: 8,
    categoryValue: 2,
    name: "Ne",
    image: ne,
    description:
      "It's a colorless noble gas. It's orange-red when discharged. Neon is most commonly used in neon lights. The air contains a small amount of neon. Zero group element, chemical properties are not active, as a member of the noble gases.",
    featured: false,
  },
  {
    id: 9,
    categoryValue: 2,
    name: "Kr",
    image: kr,
    description:
      "A rare gas that is odorless, colorless, tasteless, and in small quantities. Krypton forms one millionth of the atmosphere and is obtained in the production of liquid air.",
    featured: false,
  },
  {
    id: 10,
    categoryValue: 2,
    name: "He",
    description:
      "Usually a colorless, odorless gas, it is the only substance that cannot cure at standard atmospheric pressure. Helium is the least reactive element. It is mainly used as protective gas, working fluid of gas - cooled nuclear reactor and cryogenic refrigerant.",
    image: he,
    featured: false,
  },
];

// Electronic Gases 类别产品数据 (categoryValue: 3)
export const electronicGasesData = [
  {
    id: 11,
    categoryValue: 3,
    name: "TiCl₄",
    image: ticl4,
    description:
      "It is an inorganic compound with the formula TiCl4. Titanium tetrachloride is an important intermediate in the production of titanium and its compounds. At room temperature, titanium tetrachloride is a colorless liquid and smokes in air to form a mixture of titanium dioxide solids and hydrochloric acid droplets. ",
    featured: true,
  },
  {
    id: 12,
    categoryValue: 3,
    name: "C₃H₈",
    description:
      "It is usually a gaseous state, but is usually compressed into a liquid state and transported. After crude oil or natural gas treatment, propane can be obtained from the finished oil. Propane is commonly used as fuel for engines, barbecue food and home heating systems. ",
    image: c3h8,
    featured: false,
  },
  {
    id: 13,
    categoryValue: 3,
    name: "CH₄",
    image: ch4,
    description:
      "Methane is the simplest hydrocarbon. Widely exist in natural gas, biogas, coal mine pit gas, is a high quality gas fuel, is also an important raw material for manufacturing syngas and many chemical products. ",
    featured: false,
  },
  {
    id: 14,
    categoryValue: 3,
    name: "CHF₃",
    image: chf3,
    description:
      "Trifluoromethane, also known as trifluoromethane, is a colorless, odorless, non-conductive gas that is an ideal substitute for halogens. ",
    featured: false,
  },
  {
    id: 15,
    categoryValue: 3,
    name: "CO",
    image: co,
    description:
      "Is colorless, odorless, tasteless, toxic gas, insoluble in water, melting point -199 ° C, boiling point -191.5 ° C. Under the standard condition, the gas density is L.25g /L, which is very different from the air density (1.293g/L under the standard condition), which is also one of the factors prone to gas poisoning. It is a neutral gas. ",
    featured: false,
  },
  {
    id: 16,
    categoryValue: 3,
    name: "HCL",
    image: hcl,
    description:
      "Is a colorless non-flammable gas, has a very stimulating smell, the proportion is larger than air, in the case of humid air to produce white fog, easily soluble in water, hydrochloric acid. Strong corrosive, can react with a variety of metals to produce hydrogen, can form an explosive mixture with air, in case of cyanide to produce highly toxic hydrogen cyanide.",
    featured: false,
  },
  {
    id: 17,
    categoryValue: 3,
    name: "CO",
    image: co,
    description:
      "Is colorless, odorless, tasteless, toxic gas, insoluble in water, melting point -199 ° C, boiling point -191.5 ° C. Under the standard condition, the gas density is L.25g /L, which is very different from the air density (1.293g/L under the standard condition), which is also one of the factors prone to gas poisoning. It is a neutral gas. ",
    featured: false,
  },
];

// 合并所有产品数据（保持向后兼容）
export const productsData = [
  ...precursorsData,
  ...specialityGasesData,
  ...electronicGasesData,
];

// 获取特色产品
export const getFeaturedProducts = () => {
  return productsData.filter((product) => product.featured);
};

// 根据分类获取产品
export const getProductsByCategory = (category) => {
  if (category === "all") {
    return productsData;
  }
  return productsData.filter((product) => product.categoryValue == category);
};

// 根据分类直接获取对应数据组
export const getProductDataByCategory = (category) => {
  switch (category) {
    case 1:
      return precursorsData;
    case 2:
      return specialityGasesData;
    case 3:
      return electronicGasesData;
    default:
      return productsData;
  }
};

// 根据ID获取产品
export const getProductById = (id) => {
  return productsData.find((product) => product.id === parseInt(id));
};

// 产品详细信息生成器
export const generateProductDetails = (id, locale = "en") => {
  const productNames = {
    zh: ["Precursors", "Speciality Gases", "Electronic Gases"],
    en: ["Precursors", "Speciality Gases", "Electronic Gases"],
  };

  const productDescriptions = {
    zh: [
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
    ],
    en: [
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
      "Focus on the electronic speciality gas business and regularly reach close cooperation with famous semiconductor, display panel, photovoltaic and other industries customers.",
    ],
  };

  // 根据产品ID确定分类
  let categoryIndex = 0;
  if (id >= 1 && id <= 3) categoryIndex = 0; // Precursors
  else if (id >= 4 && id <= 6) categoryIndex = 1; // Speciality Gases
  else if (id >= 7 && id <= 9) categoryIndex = 2; // Electronic Gases

  return {
    id,
    name: productNames[locale][categoryIndex] || `Product ${id}`,
    description:
      productDescriptions[locale][categoryIndex] ||
      `Description for product ${id}`,
    shortDescription:
      productDescriptions[locale][categoryIndex] ||
      `Short description for product ${id}`,
    longDescription: `${productDescriptions[locale][categoryIndex]} ${
      locale === "zh"
        ? "该产品经过精心设计和严格测试，确保为用户提供最佳体验。"
        : "This product has been carefully designed and rigorously tested to ensure the best user experience."
    }`,
    features:
      locale === "zh"
        ? [
            "高品质材料",
            "精工制作",
            "用户友好设计",
            "持久耐用",
            "性价比高",
            "售后保障",
          ]
        : [
            "High-quality materials",
            "Precision craftsmanship",
            "User-friendly design",
            "Long-lasting durability",
            "Great value",
            "After-sales support",
          ],
    specifications: {
      [locale === "zh" ? "品牌" : "Brand"]:
        locale === "zh" ? "优质品牌" : "Premium Brand",
      [locale === "zh" ? "型号" : "Model"]: `Model-${id}`,
      [locale === "zh" ? "颜色" : "Color"]:
        locale === "zh" ? "多色可选" : "Multiple colors available",
      [locale === "zh" ? "保修" : "Warranty"]:
        locale === "zh" ? "1年保修" : "1 Year Warranty",
    },
  };
};
